<template>
  <view class="wrapper">
    <create v-if="currentIndex === 0" />
    <mine v-if="currentIndex === 1" />
    <bottom-tab
      v-model="currentIndex"
      :tabs="tabs"
      need-indicator
      @change="onTabChange"
    />
  </view>
</template>
<script>
import create from './create'
import mine from "./mine"
import BottomTab from '@/components/BottomTab'
export default {
  components: {
    BottomTab,
    create,
    mine
  },
  data() {
    return {
      tabs: [
        {
          title: '新申请',
          active_icon: '/approval/img/shenqing_active.png',
          inactive_icon: '/approval/img/shenqing_inactive.png'
        },
        {
          title: '已提交',
          active_icon: '/approval/img/tijiao_active.png',
          inactive_icon: '/approval/img/tijiao_inactive.png'
        }
      ],
      currentIndex: 0
    }
  },
  onLoad(options){
    if(options && options.tab){
      this.onTabChange(parseInt(options.tab))
    }
  },
  methods: {
    onTabChange(index){
      this.currentIndex = index
    }
  }
};
</script>
